<?php
 /*
 * 1626cms 會員登入代碼
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once('../include/common.inc.php');
header("Content-Type: application/x-javascript;charset=utf8");
require_once(QISHI_ROOT_PATH.'include/mysql.class.php');
$db = new mysql($dbhost,$dbuser,$dbpass,$dbname);
unset($dbhost,$dbuser,$dbpass,$dbname);
$smarty->caching = false;
require_once(QISHI_ROOT_PATH.'include/fun_user.php');
if(!$_SESSION['uid'] && !$_SESSION['username'] && !$_SESSION['utype'] && $_COOKIE['Qishi']['username'] && $_COOKIE['Qishi']['password'])
{
if(check_cookie($_COOKIE['Qishi']['username'],$_COOKIE['Qishi']['password']))
{
update_user_info($_COOKIE['Qishi']['username'],false);
}
else
{
setcookie('Qishi[username]',"", time() - 3600,$cookiepath, $cookiedomain);
setcookie('Qishi[password]',"", time() - 3600,$cookiepath, $cookiedomain);
}
}
//判斷登入狀態
if ($_SESSION['uid'] && $_SESSION['username'] && $_SESSION['utype'])
{
$content.="<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"12\" align=\"center\"  class=\"link_lan\">";
$content.="<tr>";
$content.="<td align=\"center\">歡迎&nbsp;&nbsp;<a href=\"user.php\" style=\"color:#339900\">".$_SESSION['username']."</a>&nbsp;&nbsp; 登入！</td>";
$content.="</tr>";
$content.="<tr>";
$content.="<td align=\"center\"><a href=\"".url_rewrite('user')."\" style=\" display:block;width:160px; height:28px; background-color:#FF9900; color:#FFFFFF; border:1px #990000 solid ; text-align:center; line-height:28px;\">[進入會員中心]</a></td>";
$content.="</tr>";
$content.="<tr>";
$content.="<td align=\"center\"><a href=\"".url_rewrite('user')."?act=logout\" >[登出]</a></td>";
$content.="</tr>";
$content.="</table>";
echo "document.writeln('".$content."');";
}
else
{
$content.="<form action=\"".url_rewrite('user')."?act=do_login\" method=\"post\">";
$content.="<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\" class=\"link_bk\">";
$content.="<tr>";
$content.="<td width=\"58\" align=\"right\">用戶名：<br /></td>";
$content.="<td><input name=\"username\" type=\"text\" id=\"username\" maxlength=\"30\"  class=\"search_login_input\" /></td>";
$content.="</tr>";
$content.="<tr>";
$content.="<td align=\"right\">密&nbsp;&nbsp;&nbsp;&nbsp;碼：</td>";
$content.="<td><input name=\"password\" type=\"password\" id=\"password\" maxlength=\"30\"  class=\"search_login_input\" /></td>";
$content.="</tr>";
$content.="<tr>";
$content.="<td  >&nbsp;</td>";
$content.="<td height=\"35\"><input type=\"image\" name=\"imageField\" src=\"".$_CFG['site_template']."images/login_subm.jpg\" />&nbsp;&nbsp;&nbsp;<a href=\"".url_rewrite('user')."?act=get_pass_index\">忘記密碼？</a></td>";
$content.="</tr>";
$content.="<tr>";
$content.="<td colspan=\"2\" align=\"center\" style=\" border-top: 1px #CCCCCC dashed\"><a href=\"".url_rewrite('user')."?act=reg1\"><img src=\"".$_CFG['site_template']."images/reg_subm.jpg\"  border=\"0\" /></a></td>";
$content.="</tr>";
$content.="</table>";
$content.="</form>";
echo "document.writeln('".$content."');";
}
?>
